Skip to content

Add wp core check-update-db command#294

Open
Copilot wants to merge 10 commits intomainfrom
copilot/improve-db-update-commands
Open

Add wp core check-update-db command#294
Copilot wants to merge 10 commits intomainfrom
copilot/improve-db-update-commands

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

  • Add check-update-db method to Core_Command class
  • Implement logic to check if database update is needed (compare wp_db_version with current db_version)
  • Add support for --network flag for multisite installations
  • Add appropriate WP-CLI output messages
  • Update composer.json to register the new command
  • Create Behat feature tests for the new command
  • Address PR feedback:
    • Revert README.md (auto-generated file)
    • Fix composer.json semver version range
    • Fix code formatting alignment
  • Request code review and security scan (both passed with no issues)

Summary

Successfully implemented wp core check-update-db command that checks whether a WordPress database update is needed. The command:

  • Returns exit code 1 when update is needed, 0 when database is up to date
  • Compares wp_db_version with current db_version option
  • Supports --network flag to check all sites in a multisite installation
  • Follows the same patterns as existing wp core check-update command
  • Includes comprehensive Behat tests for single site and multisite scenarios

All PR feedback has been addressed.

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve DB update commands</issue_title>
<issue_description>We currently have a command wp core update-db that sometimes needs to be run after an update of Core.

It would be great to have a mechanism to check whether an update is actually needed.

Also, both commands might make more sense as wp db ... commands, instead of wp core ... commands.

Suggestion:

wp db check-update     Checks for the need for WordPress database updates.
wp db update           Runs the WordPress database update procedure.

Related issue: wp-cli/wp-cli#5085

cc @swissspidy </issue_description>

<agent_instructions>The new command should be wp core check-update-db, to align with wp core check-update</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 29, 2025 20:27
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve DB update commands for WordPress Add wp core check-update-db command Oct 29, 2025
Copilot AI requested a review from swissspidy October 29, 2025 20:34
@swissspidy

This comment was marked as resolved.

Copilot AI and others added 2 commits October 29, 2025 20:55
- Revert README.md changes (file is auto-generated)
- Restore composer/semver version range to "^1.4 || ^2 || ^3"

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review October 30, 2025 15:18
@swissspidy swissspidy requested a review from a team as a code owner October 30, 2025 15:18
@codecov

This comment was marked as resolved.

@swissspidy swissspidy added this to the 2.2.0 milestone Nov 2, 2025
@swissspidy swissspidy added the command:core Related to 'core' command label Dec 12, 2025

This comment was marked as resolved.

@swissspidy swissspidy modified the milestones: 2.1.23, 2.1.24 Jan 10, 2026
@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:core Related to 'core' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve DB update commands

2 participants